package com.eascs.admin.common.dao;

import java.util.List;

import javax.inject.Inject;
import javax.sql.DataSource;

import org.springframework.jdbc.core.JdbcTemplate;

import com.eascs.app.dao.JdbcSession;
import com.eascs.app.dao.PageResult;
import com.eascs.app.dao.ResultSets;
import com.eascs.app.dao.SqlPageQuery;
import com.eascs.app.dao.StoreProcedure;
import com.eascs.app.dao.TableData;

public abstract class BaseReportDao {
	@Inject
	protected JdbcSession reportJdbcSession;

	public <T> T getByIdWithEntity(T entity) {
		return reportJdbcSession.getByIdWithEntity(entity);
	}

	public <T> int deleteByIdWithEntity(T entity) {
		return reportJdbcSession.deleteByIdWithEntity(entity);
	}

	public <T> T getById(Class<T> entityClass, Object... id) {
		return reportJdbcSession.getById(entityClass, id);
	}

	public <T> int deleteById(Class<T> entityClass, Object... id) {
		return reportJdbcSession.deleteById(entityClass, id);
	}

	public <T> int insert(T entity) {
		return reportJdbcSession.insert(entity);
	}

	public <T> int updateById(T entity) {
		return reportJdbcSession.updateById(entity);
	}

	public <T> List<T> findEntitys(String sql, Class<T> requiredType, Object... params) {
		return reportJdbcSession.findEntitys(sql, requiredType, params);
	}

	public <T> T findEntity(String sql, Class<T> requiredType, Object... params) {
		return reportJdbcSession.findEntity(sql, requiredType, params);
	}

	public <T> List<T> findSimpleObjectList(String sql, Class<T> requiredType, Object... params) {
		return reportJdbcSession.findSimpleObjectList(sql, requiredType, params);
	}

	public <T> T findSimpleObject(String sql, Class<T> requiredType, Object... params) {
		return reportJdbcSession.findSimpleObject(sql, requiredType, params);
	}

	public Integer findInteger(String sql, Object... params) {
		return reportJdbcSession.findInteger(sql, params);
	}

	public String findString(String sql, Object... params) {
		return reportJdbcSession.findString(sql, params);
	}

	public TableData findTableData(String sql, Object... params) {
		return reportJdbcSession.findTableData(sql, params);
	}

	public List<Object[]> findObjectsList(String sql, Object... params) {
		return reportJdbcSession.findObjectsList(sql, params);
	}

	public int execute(String sql, Object... params) {
		return reportJdbcSession.execute(sql, params);
	}

	public int[] batchExecute(String sql, List<Object[]> params) {
		return reportJdbcSession.batchExecute(sql, params);
	}

	public ResultSets callSP(StoreProcedure storeProcedure) {
		return reportJdbcSession.callSP(storeProcedure);
	}

	public String insertWithReturnKey(String insertSql, Object... params) {
		return reportJdbcSession.insertWithReturnKey(insertSql, params);
	}

	public String getSql(String sql) {
		return reportJdbcSession.getSql(sql);
	}
	public void setDataSource(DataSource dataSource) {
		reportJdbcSession.setDataSource(dataSource);
	}
	public <T> PageResult<T> findDataWithPage(SqlPageQuery<T> sqlPageQuery) {
		return reportJdbcSession.findDataWithPage(sqlPageQuery);
	}

	public JdbcTemplate getJdbcTemplate() {
		return reportJdbcSession.getJdbcTemplate();
	}

	
}
